using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;

namespace OpenFlashChartLib
{
    public class GraphTicks : RenderBase
    {
        public static readonly string XTicksToken = "x_ticks";
        public static readonly string YTicksToken = "y_ticks";
        private string _token;
        private int _size = -1;

        public GraphTicks(string token)
        {
            this._token = token;
        }

        public int Size
        {
            get { return _size; }
            set { _size = value; }
        }

        public override void Render(HtmlTextWriter writer)
        {
            if (_token == XTicksToken && Size <= 0)
                return;
            base.Render(writer);
        }

        public override void RenderContent(HtmlTextWriter writer)
        {

            if (_token == XTicksToken)
            {
                if (Size <= 0)
                    return;
                writer.Write(_token);
                writer.Write("=");
                writer.Write(Size);
            }
            else if (_token == YTicksToken)
            {
                writer.Write(_token);
                writer.Write("=");
                writer.Write("5,10,");
                if (Size <= 0)
                    writer.Write("2");
                else
                    writer.Write(Size);
            }
        }
    }
}
